<template>
  <el-dialog
    :visible.sync="visible"
    :show="show"
    :title="'提示——'+title"
    width="60%"
    @close="OnClose()"
  >
    <span>需要注意的是内容是默认不居中的</span>
    <span slot="footer" class="dialog-footer">
      <el-button @click="OnClose">取 消</el-button>
      <el-button type="primary" @click="OnClose">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
  name: "TemplateDialog",
  props: {
    show: { type: Boolean, default: false },
    title: "",
  },
  data() {
    return {
      visible: this.show,
    };
  },
  watch: {
    show: {
      immediate: true,
      handler(show) {
        this.visible = this.show;
      },
    },
  },
  methods: {
    OnClose() {
      this.$emit("update:show", false);
    },
  },
};
</script>